<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">











<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>Doxia Module: Syntax Highlighted Snippet - </title>
    <style type="text/css" media="all">
      @import url("./css/maven-base.css");
      @import url("./css/maven-theme.css");
      @import url("./css/site.css");
    </style>
    <link rel="stylesheet" href="./css/print.css" type="text/css" media="print" />
        <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
                                                    
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript"></script>
                                                        
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">_uacct = "UA-140879-1";
        urchinTracker();</script>
                    </head>
  <body class="composite">
    <div id="banner">
                  <a href="http://maven.apache.org/doxia/doxia/doxia-modules" id="bannerLeft">
    
                                    <img src="http://maven.apache.org/doxia/doxia/images/apache-maven-project-2.png" alt="" />
    
            </a>
                        <a href="http://maven.apache.org/doxia/doxia/doxia-modules" id="bannerRight">
    
                                    <img src="http://maven.apache.org/doxia/doxia/images/maven-logo-2.gif" alt="" />
    
            </a>
            <div class="clear">
        <hr/>
      </div>
    </div>
    <div id="breadcrumbs">
          
  

  
    
            
  
    
            <div class="xleft">
        Version: 1.0-alpha-11
              </div>
            <div class="xright">            <a href="http://www.apache.org/" class="externalLink">Apache</a>
            |
                <a href="http://maven.apache.org/../maven-1.x" class="externalLink">Maven 1.x</a>
            |
                <a href="http://maven.apache.org/../" class="externalLink">Maven 2.x</a>
            |
                <a href="http://maven.apache.org/../scm" class="externalLink">SCM</a>
            |
                <a href="http://maven.apache.org/../wagon" class="externalLink">Wagon</a>
            |
                <a href="http://maven.apache.org/../jxr" class="externalLink">JXR</a>
            |
                <a href="http://maven.apache.org/" class="externalLink">Doxia</a>
            |
                <a href="http://maven.apache.org/maven-1.x" class="externalLink">Maven 1.x</a>
            |
                <a href="http://maven.apache.org/" class="externalLink">Maven 2.x</a>
            |
                <a href="http://maven.apache.org/scm" class="externalLink">SCM</a>
            |
                <a href="http://maven.apache.org/wagon" class="externalLink">Wagon</a>
            |
                <a href="http://maven.apache.org/jxr" class="externalLink">JXR</a>
            |
                <a href="http://maven.apache.org/doxia" class="externalLink">Doxia</a>
            
  

  
    
            
  
    
            &nbsp;| Last Published: 17 Feb 2009
            </div>
      <div class="clear">
        <hr/>
      </div>
    </div>
    <div id="leftColumn">
      <div id="navcolumn">
           
  

  
    
            
  
    
                   <h5>Main</h5>
            <ul>
              
    <li class="none">
              <strong>About</strong>
        </li>
              
    <li class="none">
                    <a href="manual.html">Manual</a>
          </li>
          </ul>
              <h5>Download</h5>
            <ul>
              
    <li class="none">
                    <a href="http://syntax-highlighted-snippet.googlecode.com/files/syntax-highlighted-snippet-1.0-alpha-11.jar" class="externalLink">Artifact</a>
          </li>
              
    <li class="none">
                    <a href="http://syntax-highlighted-snippet.googlecode.com/files/syntax-highlighted-snippet-1.0-alpha-11-sources.jar" class="externalLink">Source</a>
          </li>
          </ul>
              <h5>Parent Project</h5>
            <ul>
              
    <li class="none">
                    <a href="http://maven.apache.org/doxia/doxia/doxia-modules/index.html" class="externalLink">Doxia :: Modules</a>
          </li>
          </ul>
                        <h5>Project Documentation</h5>
            <ul>
              
                
              
      
            
      
            
      
            
      
            
      
            
      
            
      
            
      
            
      
            
      
            
      
              
        <li class="collapsed">
                    <a href="project-info.html">Project Information</a>
                </li>
              
                
              
      
              
        <li class="collapsed">
                    <a href="project-reports.html">Project Reports</a>
                </li>
          </ul>
                                           <a href="http://maven.apache.org/" title="Built by Maven" class="poweredBy">
            <img alt="Built by Maven" src="./images/logos/maven-feather.png"></img>
          </a>
                       
  

  
    
            
  
    
        </div>
    </div>
    <div id="bodyColumn">
      <div id="contentBox">
        <div class="section"><h2>About Doxia Module: Syntax Highlighted Snippet</h2>
<p>This module is alternative for <a href="http://maven.apache.org/doxia/macros/index.html" class="externalLink">Snippet Macro</a>
. This implementation allows to include entire file when <i>id</i>
 parameter isn't defined. </p>
<p>This implementation also provides syntax highlighting for code snippet. It was inspired by <a href="http://www.ancientprogramming.com/2008/06/05/how-to-create-macros-for-maven-site-plugin/" class="externalLink">How to create macros for maven-site-plugin</a>
 Highlighting is implemented by <a href="http://code.google.com/p/syntaxhighlighter/" class="externalLink">SyntaxHighlighter</a>
. </p>
</div>
<div class="section"><h2>Quick Guide</h2>
<div class="section"><h3>Configure</h3>
<p>To be able to use the macro you have to add your macro as dependency to the maven-site-plugin:</p>
<pre name="code" class="xml:firstline[34]" style="margin:1em 7px;padding:12px;background-color:#FFFFFF;border:1px solid #888888;color:#000000;">&lt;plugin&gt;
    &lt;artifactId&gt;maven-site-plugin&lt;/artifactId&gt;
    &lt;dependencies&gt;
        &lt;dependency&gt;
            &lt;groupId&gt;sk.dvsk.maven&lt;/groupId&gt;
            &lt;artifactId&gt;doxia-module-highlight&lt;/artifactId&gt;
            &lt;version&gt;1.0-alpha-11&lt;/version&gt;
        &lt;/dependency&gt;
    &lt;/dependencies&gt;
&lt;/plugin&gt;
</pre>
</div>
<div class="section"><h3>Usage</h3>
<p>Now you can use the macro by writing the following in your apt files:</p>
<pre name="code" class="vm:nocontrols:firstline[17]" style="margin:1em 7px;padding:12px;background-color:#FFFFFF;border:1px solid #888888;color:#000000;">%{code-snippet|id=usage|file=pom.xml}
</pre>
</div>
<div class="section"><h3>Highlighting</h3>
<p>At the end of file, where you use this macro, you can add macro to enable syntax highlighting:</p>
<pre name="code" class="vm:nocontrols:firstline[33]" style="margin:1em 7px;padding:12px;background-color:#FFFFFF;border:1px solid #888888;color:#000000;">%{enable-highlighter|url=http://syntax-highlighted-snippet.googlecode.com/svn/public}
</pre>
<!-- syntax highlighter -->
<link type="text/css" rel="stylesheet" href="http://syntax-highlighted-snippet.googlecode.com/svn/public/SyntaxHighlighter.css"></link>
<script language="javascript" src="http://syntax-highlighted-snippet.googlecode.com/svn/public/shCore.js"></script>
<script language="javascript" src="http://syntax-highlighted-snippet.googlecode.com/svn/public/shBrushCss.js"></script>
<script language="javascript" src="http://syntax-highlighted-snippet.googlecode.com/svn/public/shBrushJScript.js"></script>
<script language="javascript" src="http://syntax-highlighted-snippet.googlecode.com/svn/public/shBrushJava.js"></script>
<script language="javascript" src="http://syntax-highlighted-snippet.googlecode.com/svn/public/shBrushSql.js"></script>
<script language="javascript" src="http://syntax-highlighted-snippet.googlecode.com/svn/public/shBrushXml.js"></script>
<script language="javascript">
	dp.SyntaxHighlighter.HighlightAll('code');
</script>

</div>
</div>

      </div>
    </div>
    <div class="clear">
      <hr/>
    </div>
    <div id="footer">
      <div class="xright">&#169;  
          2002-2009
    
          The Apache Software Foundation
          
  

  
    
            
  
    
  </div>
      <div class="clear">
        <hr/>
      </div>
    </div>
  </body>
</html>
